﻿using CSharp.Basic.Learn.EventBus.Events;
using System;
using System.Threading.Tasks;

namespace CSharp.Basic.Learn.EventBus.Implement
{
  /// <summary>
  /// 用户添加事件
  /// </summary>
  public class UserAddedEvent : IntegrationEvent
  {
    public string UserName { get; set; }
  }

  /// <summary>
  /// 负责处理用户添加事件
  /// </summary>
  public class UserAddedEventHandler : IIntegrationEventHandler<UserAddedEvent>
  {
    public Task Handle(UserAddedEvent @event)
    {
      Console.WriteLine("用户添加成功：" + @event.UserName);
      return Task.CompletedTask;
    }
  }
}
